package com.asimplefox.controllers;

import com.asimplefox.serurity.UserRoleDetails;
import com.asimplefox.service.IInviteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author github.kloping
 */
@RestController
@RequestMapping("/api/invite")
@PreAuthorize("hasAnyAuthority('user')")
public class InviteController {
    @Autowired
    IInviteService inviteService;

    @GetMapping("/all")
    public Object all(@AuthenticationPrincipal UserRoleDetails details) {
        return inviteService.all(details);
    }
}
